/**
 * 
 */
package loansManagement;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;





import mediasManagement.Exemplary;
import subscribersManagement.Subscriber;

/** 
 * @author virgil
 */
@Embeddable
public class LoanId implements Serializable{


	
	
	 public int hashCode() {
		 int result;
	        result = (exemplary != null ? exemplary.hashCode() : 0);
	        result = 31 * result + (subscriber != null ? subscriber.hashCode() : 0);
	        return result;
		  }
		 
		  public boolean equals(Object o) {
			  if (this == o) return true;
			     if (o == null || getClass() != o.getClass()) return false;
			     LoanId that= (LoanId) o;
			     if (exemplary != null ? !exemplary.equals(that.exemplary) : that.exemplary != null) return false;
			     if (subscriber != null ? !subscriber.equals(that.subscriber) : that.subscriber!= null)
			            return false;
			 
			     return true;
		  }

		/**
		 * @uml.property  name="exemplary"
		 * @uml.associationEnd  inverse="loanId:mediasManagement.Exemplary"
		 */
		  @	OneToOne(fetch=FetchType.LAZY)
		private Exemplary exemplary;

		/**
		 * Getter of the property <tt>exemplary</tt>
		 * @return  Returns the exemplary.
		 * @uml.property  name="exemplary"
		 */
		public Exemplary getExemplary() {
			return exemplary;
		}

		/**
		 * Setter of the property <tt>exemplary</tt>
		 * @param exemplary  The exemplary to set.
		 * @uml.property  name="exemplary"
		 */
		public void setExemplary(Exemplary exemplary) {
			this.exemplary = exemplary;
		}

		/**
		 * @uml.property  name="subscriber"
		 * @uml.associationEnd  inverse="loanId:subscribersManagement.Subscriber"
		 */
		@ManyToOne
		private Subscriber subscriber;

		/**
		 * Getter of the property <tt>subscriber</tt>
		 * @return  Returns the subscriber.
		 * @uml.property  name="subscriber"
		 */
		public Subscriber getSubscriber() {
			return subscriber;
		}

		/**
		 * Setter of the property <tt>subscriber</tt>
		 * @param subscriber  The subscriber to set.
		 * @uml.property  name="subscriber"
		 */
		public void setSubscriber(Subscriber subscriber) {
			this.subscriber = subscriber;
		}
}
